package com.cy.pj.common.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MailServiceImpl implements MailService {

    @Override
    public boolean sendMail(String msg) {
        System.out.println("send->"+msg);
        return true;
    }
}
//class TimeMailServiceImpl extends MailServiceImpl{
//    @Override
//    public boolean sendMail(String msg) {
//        long t1=System.nanoTime();
//        boolean flag=super.sendMail(msg);
//        long t2=System.nanoTime();
//        System.out.println("send time:"+(t2-t1));
//        return flag;
//    }
//}
class TimeMailServiceImpl implements MailService{
    @Autowired
    private MailService mailService;
    @Override
    public boolean sendMail(String msg) {
        long t1=System.nanoTime();
        boolean flag=mailService.sendMail(msg);
        long t2=System.nanoTime();
        System.out.println("send time:"+(t2-t1));
        return flag;
    }
}
